#pragma once

#include <string>
#include <vector>

namespace solution_012
{

/*
 * Symbol       Value
 * I             1
 * V             5
 * X             10
 * L             50
 * C             100
 * D             500
 * M             1000
 */

class Solution
{
public:
    std::string intToRoman(int num)
    {
        std::string symbols = "IVXLCDM";
        std::string roman;
        for (int i = 0; num > 0; i += 2, num /= 10) {
            switch (num % 10) {
                case 3: roman.push_back(symbols.at(i));
                case 2: roman.push_back(symbols.at(i));
                case 1: roman.push_back(symbols.at(i));
                        break;

                case 8: roman.push_back(symbols.at(i));
                case 7: roman.push_back(symbols.at(i));
                case 6: roman.push_back(symbols.at(i));
                        roman.push_back(symbols.at(i + 1));
                        break;

                case 4: roman.push_back(symbols.at(i + 1));
                        roman.push_back(symbols.at(i));
                        break;

                case 9: roman.push_back(symbols.at(i + 2));
                        roman.push_back(symbols.at(i));
                        break;

                case 5: roman.push_back(symbols.at(i + 1));
                        break;
            }
        }
        return std::string(roman.crbegin(), roman.crend());
    }
};

}  /* namespace solution_012 */
